Skip to content

mesa: Clamp a buffer descriptor's range to its buffer (#128) - #141

Merged
Broyojo merged 1 commit into
mainfrom
kk-ubo-range
Oct 26, 2026
Merged

Broyojo merged 1 commit into
mainfrom
kk-ubo-range

Conversation

@Broyojo

@Broyojo Broyojo commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Stacked on #140.

Once depth bounds are reported, DOOM (2016) aborts on a Mesa assertion, range + offset <= buffer->size. It writes uniform buffer descriptors with a 64 KB range on buffers of 49,152 and 65,520 bytes (#128). That is invalid Vulkan, and our Mesa is built with assertions on.

Turning the assertions off wouldn't be enough. With the range kept as given, KosmicKrisp's bounds checks let the shader read past the buffer into whatever memory follows it.

Mesa patch 0086 clamps a buffer descriptor's range (and a transform feedback buffer's) to the end of its buffer. Reads past the end are then out of bounds like any other: zero with robust access. Valid ranges are unchanged. Findings #58.

Testing:

  • New tests/mac/vk-ubo-range-past-end.sh writes descriptors the way DOOM does, plain and dynamic, with a marker-filled buffer right after.
    • The installed driver aborts on DOOM's assertion.
    • The new driver reads the buffer's data inside it and zero past it.
    • A build with the range kept and no assertion reads the next buffer's marker.
  • Vulkan CTS, one in three of the robustness, uniform buffer, transform feedback and binding model lists: 52,804 pass, 0 fail.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T23:33:53.308945Z d2461d9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

DOOM (2016) writes uniform buffer descriptors with a 64 KB range on smaller
buffers, which aborted on an assertion in Mesa; without it the reads would
have gone past the buffer into other memory. Mesa patch 0086 clamps the
range, so they are out of bounds like any other. tests/mac/vk-ubo-range-past-end.sh,
findings #58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KCKKoKPBaWBVBojHFrLgQ9
Base automatically changed from kk-depth-bounds to main October 26, 2026 18:29
@Broyojo
Broyojo merged commit 1c2f79a into main Oct 26, 2026
4 checks passed
@Broyojo
Broyojo deleted the kk-ubo-range branch October 26, 2026 18:29
@Broyojo Broyojo mentioned this pull request Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant